package cringer::smartalleck;

# smartalleck.pm
# Comes up with trash talk for cringer

our $VERSION = '2.0';

sub said{
 my $self = $_[0];
 my $args = $_[1];
 my $me = $self->{nick};
 
 
 my $sql = qq~SELECT response FROM general_responses WHERE MATCH (tags) AGAINST (? IN BOOLEAN MODE) ORDER BY RAND() LIMIT 1;~;
 my $q = $self->{d}->prepare($sql);
 $q->execute($args->{body});
 while(my $r = $q->fetchrow_hashref()){
  $self->say(
   channel => $args->{channel},
   who => $args->{who},
   body => $r->{response}
  );
 }
 return;
}

sub commandList{ # a simple help routine to return a list of the commands we'll respond to
}

return 1;